package com.jv.spring.autowiredannotation.scan;

import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@Getter
@Setter
public class  AutowiredAnnotationUser implements EnvironmentAware {

	private Environment environment;

	@Autowired
	private AutowiredAnnotationDept dept;

	//public AutowiredAnnotationUser(){}

	/*@Autowired(required = true)
	private AutowiredAnnotationUser(AutowiredAnnotationDept dept){
		this.dept = dept;
	}*/
	/*@Autowired(required = false)
	public AutowiredAnnotationUser(AutowiredAnnotationDept dept,String name){
		this.dept = dept;
		this.name = name;
	}*/

	@Value("${name}")
	private String name;

	@Value("${age}")
	private Integer age;

	@Override
	public void setEnvironment(Environment environment) {
		this.environment = environment;
	}
}
